﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace sy1_8
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            textBox1.Text = "30";
            label2.Text = "";
            label2.Font = new Font("Times New Roman", 40, FontStyle.Bold);
            timer1.Interval = 1000;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            label2.Text = textBox1.Text;
            timer1.Enabled = true;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            label2.Text = (int.Parse(label2.Text) - 1).ToString();
            if (label2.Text=="0")
            {
                timer1.Enabled = false;
                MessageBox.Show("时间到！");
            }

        }
    }
}
